package bean.dao;

import org.springframework.jdbc.core.JdbcTemplate;

import javax.sql.DataSource;

//一个简单的jdbc的dao类
public class NewsDao {
    private DataSource dataSource;

    public void setDataSource(DataSource dataSource) {
        this.dataSource = dataSource;
    }

    public DataSource getDataSource() {
        return dataSource;
    }

    public void insert(String title,String content){
        JdbcTemplate jt = new JdbcTemplate(dataSource);
        jt.update("insert into news_inf values(null,?,?)",title,content);
//        jt.update("insert into news_inf values(null,?,?)",title,content);
    }
}
